//
//  ProductOfferRecordListCell.m
//  MyNewProject
//
//  Created by ZhangYuan on 2019/1/29.
//  Copyright © 2019年 sun. All rights reserved.
//

#import "ProductOfferRecordListCell.h"

@implementation ProductOfferRecordListCell
- (nonnull instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addSubview:self.offerTimeLabel];
        [self addSubview:self.userHeadImage];
        [self addSubview:self.userName];
        [self addSubview:self.offerPrice];
        [self addSubview:self.offerStatus];
        [self addSubview:self.lineView];
    }
    return self;
}
-(void)LoadProductInfomation:(NSDictionary *)info andType:(NSInteger)type{
    _offerTimeLabel.text = @"2019-01-28 16:00";
    _userHeadImage.backgroundColor = [UIColor brownColor];
    _userName.text = @"用户名称";
    _offerPrice.text = @"￥88888.0";
    _offerStatus.text = type == 1?@"竞购成功":@"出局";
    
    _userName.textColor = type == 1?[UIColor redColor]:[UIColor darkTextColor];
    _offerPrice.textColor = type == 1?[UIColor redColor]:[UIColor darkTextColor];
    _offerStatus.textColor = type == 1?[UIColor redColor]:[UIColor darkTextColor];
}
-(UILabel *)offerTimeLabel{
    if (!_offerTimeLabel) {
        _offerTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 200,30)];
        _offerTimeLabel.textColor = [UIColor darkGrayColor];
        _offerTimeLabel.font = [UIFont systemFontOfSize:14];
    }
    return _offerTimeLabel;
}
-(UIImageView *)userHeadImage{
    if (!_userHeadImage) {
        _userHeadImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 30, 40, 40)];
        _userHeadImage.clipsToBounds = YES;
        _userHeadImage.layer.cornerRadius = 20;
    }
    return _userHeadImage;
}
-(UILabel *)userName{
    if (!_userName) {
        _userName = [[UILabel alloc]initWithFrame:CGRectMake(65, 30, SCREEN_WIDTH/2.0 - 70, 40)];
        _userName.font = [UIFont systemFontOfSize:16];
    }
    return _userName;
}
-(UILabel *)offerPrice{
    if (!_offerPrice) {
        _offerPrice = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2.0, 30, SCREEN_WIDTH/2.0 - 100, 40)];
        _offerPrice.font = [UIFont systemFontOfSize:14];
    }
    return _offerPrice;
}
-(UILabel *)offerStatus{
    if (!_offerStatus) {
        _offerStatus = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 100, 30, 80, 40)];
        _offerStatus.textAlignment = NSTextAlignmentRight;
        _offerStatus.font = [UIFont systemFontOfSize:14];
    }
    return _offerStatus;
}
-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 80, SCREEN_WIDTH, 5)];
        _lineView.backgroundColor = BackColor;
    }
    return _lineView;
}
@end
